import { Clock, Group } from "three";
import { Shortcuts } from "shortcuts";
const shortcuts = new Shortcuts();
let clock: Clock = new Clock();
export const tick = (sceneGroup:Group,distance:number) => {
    const delta = clock.getDelta();
    const moveDistance = 0.05 * delta + distance / 2000;
    shortcuts.add([
      {
        shortcut: "up",
        handler: (e) => {
          sceneGroup.translateY(moveDistance);
        },
      },
      {
        shortcut: "down",
        handler: (e) => {
          sceneGroup.translateY(-moveDistance);
        },
      },
      {
        shortcut: "left",
        handler: (e) => {
          sceneGroup.translateX(-moveDistance);
        },
      },
      {
        shortcut: "right",
        handler: (e) => {
          sceneGroup.translateX(moveDistance);
        },
      },
    ]);
  };
